<template>
  <Layout desc="使用animation-timeline实现滚动驱动动画">
    <div class="mt-5">
      <div class="card" v-for="i in 20">{{ i }}</div>
    </div>
  </Layout>
</template>

<script setup lang="ts"></script>

<style scoped lang="scss">
.card {
  width: 200px;
  aspect-ratio: 3/4;
  background-color: #fff;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
  border-radius: 4px;
  display: grid;
  place-items: center;
  margin-bottom: 20px;

  animation: appear linear;
  animation-timeline: view();
  animation-range: entry 0 cover 25%;
}

@keyframes appear {
  from {
    opacity: 0;
    scale: 0;
  }
  to {
    opacity: 1;
    scale: 1;
  }
}
</style>
